import tkinter as tk
from send_damu import SendDanmu


win = tk.Tk()


def send_text():
    spider = SendDanmu(entry.get(), entry1.get())
    spider.run()


win.title('B站直播弹幕发送脚本-by王小呆')
x = (win.winfo_screenwidth()-400) // 2
y = (win.winfo_screenheight()-120) // 2
win.geometry(f'400x120+{x}+{y}')
tk.Label(win, text="输入直播间ID：").grid(row=0, column=0, pady=10, padx=20)
entry = tk.Entry(win)
entry.grid(row=0, column=1)  # 要先显示entry，才能insert
entry.insert(tk.INSERT, '12265')

tk.Label(win, text="输入待发送弹幕：").grid(row=1, column=0, pady=10, padx=20)
entry1 = tk.Entry(win)
entry1.grid(row=1, column=1)
entry1.insert(tk.INSERT, '发个弹幕呗~')


button = tk.Button(win, text='发送', command=send_text)
button.grid(row=1, column=2, padx=20)


win.mainloop()
